#!/bin/bash
# 删除目录下所有非tar文件及文件夹
#ls | grep -v tar | xargs -n1 sudo rm -rf
# 脚本所在路径
CURRENT_PATH=$PWD
# 其它工具包依赖源目录
CURRENT_PATH_SRC=$PWD/src
# 批量解压*.tar.gz文件， -n1 ：表示每次只传递一个参数
cd $CURRENT_PATH_SRC
ls $CURRENT_PATH_SRC/*.tar.gz | xargs -n1 tar xzvf

echo "======= 开始编译安装openssl-fips-2.0.10 ======"
cd $CURRENT_PATH_SRC/openssl-fips-2.0.10/
sudo ./config && make && make install
cd ..

echo "======= 开始编译安装pcre-8.40 ======"
cd $CURRENT_PATH_SRC/pcre-8.40/
sudo ./configure && make && make install
cd ..

echo "======= 开始编译安装zlib-1.2.11 ======"
cd $CURRENT_PATH_SRC/zlib-1.2.11/
sudo ./configure && make && make install
cd ..
ls $CURRENT_PATH_SRC| grep -v tar | xargs -n1 sudo rm -rf
# =============== 下载地址备注 =================
# # 下载openssl-fips
# wget http://www.openssl.org/source/openssl-fips-2.0.10.tar.gz
# # 下载zlib
# wget http://zlib.net/zlib-1.2.11.tar.gz
# # 下载pcre
# wget https://netix.dl.sourceforge.net/project/pcre/pcre/8.40/pcre-8.40.tar.gz
